#include<stdio.h>
#include<unistd.h>
#include<string.h>
#include<stdlib.h>
#include<sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#define FIFO_NAME "myfifo"



int main()
{
    char buffer[1024];
    int wfd = open(FIFO_NAME,O_WRONLY);
    if(wfd<0)
    {
        perror("open fail");
        exit(1);
    }

    while(true)
    {
        buffer[0] = 0;
        printf("Please Enter:");
        fflush(stdout);
        ssize_t n = read(0,buffer,sizeof(buffer)-1);
        if(n>0)
        {
            buffer[n] = 0;
            write(wfd,buffer,strlen(buffer));
        }
        else if(n<=0)
        {
            exit(1);
        }

    }
    close(wfd);
    return 0;
}